//package com.example.demo.demos.netty;
//
//import io.netty.buffer.ByteBuf;
//import io.netty.buffer.ByteBufUtil;
//import io.netty.channel.ChannelHandlerContext;
//import io.netty.channel.ChannelInboundHandlerAdapter;
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//public class TestHandler extends ChannelInboundHandlerAdapter {
//
//    @Override
//    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
//        ByteBuf buf = (ByteBuf) msg;
//
//        log.info("可读长度：{}", buf.readableBytes());
//
//        String s = ByteBufUtil.hexDump(buf);
//
//        log.info("16进制返回值：{}", s);
//
////        byte open = buf.readByte();
////        byte length = buf.readByte();
////        byte bound = buf.readByte();
////        byte messageID = buf.readByte();
////        byte respId = buf.readByte();
////        byte respDescription = buf.readByte();
////        byte status1 = buf.readByte();
////        byte status2 = buf.readByte();
////        byte status3 = buf.readByte();
////        byte status4 = buf.readByte();
////        byte crc = buf.readByte();
////        byte close = buf.readByte();
////        log.info("帧头：{},长度：{}，节点：{}，帧ID: {}，响应ID；{}，响应描述：{}，状态1：{}，状态2：{}，状态3：{}，状态4：{}，crc：{}，帧尾：{}",
////                open, length, bound, messageID, respId, respDescription, status1, status2, status3, status4, crc, close);
//    }
//
//    @Override
//    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
//        log.warn("连接错误：", cause);
//    }
//}
